<%@ page language="java" import="java.util.*,domain.*" pageEncoding="utf-8"
	contentType="text/html; charset=utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'ShopList.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
		<link rel="stylesheet" href="css/shop.css" type="text/css"></link>
	</head>

	<body  style="text-align: center">
		<%
			request.setCharacterEncoding("utf-8");
		%>
			<div id="top">
				<jsp:include page="top.jsp" />
			</div>
			<div id="center">
				<div id="centerleft">
					<div id="menulist">
					<br/>
  <br/>
						<table width="18%">
							<%
								UserInfo user = (UserInfo) session.getAttribute("UserLogin");
								if (user == null) {
							%>
							
							<jsp:include page="Login.jsp" />
							<%
								} else {
							%>
							<jsp:include page="LoginOut.jsp" />
							<%
								}
							%>
						</table>
					</div>
				</div>
				<div id="centerright">
					<div id="guide">
						您现在所在的位置：宠物在线系统>>
					</div>
					<div id="main">
						<p>
							<s:form action="ShopPet" method="post">
								<s:textfield name="condition" />
								<s:select name="choose" list="#{'宠物姓名':'宠物姓名','宠物类型':'宠物类型'}" />
								<input type="submit" value="搜索" />
							</s:form>
						</p>
						<s:iterator value="pets" status="it">
							<table width="574" height="171" border="1">
								<tr>
									<td width="178" height="165">
										<div align="center">
											<table width="117" height="132" border="0">
												<tr>
													<td width="136" height="128" align="center">
														<img width="117" height="132"
															src="Photo/<s:property value="pet_PhotoName" 
															/> " />
													</td>
												</tr>
											</table>
										</div>
									</td>
									<td width="380">
										<table width="419" height="164" border="1">
											<tr>
												<td width="349" align="center">
													昵称：
													<s:property value="pet_Name" />
													<s:property value="id" />
												</td>
											</tr>
											<tr>
												<td height="33" align="center">
													宠物出生地：
													<s:property value="pet_Produce_place" />
													&nbsp;&nbsp;&nbsp; 宠物类别：
													<s:property value="pet_ClassName" />
												</td>
											</tr>
											<tr>
												<td height="44" align="center">
													单价：
													<s:property value="pet_Price" />
												</td>
											</tr>
											<tr>
												<td height="31" align="center">
													<s:a href="ShopPetBuy?id=%{pet_Id}&name=%{pet_Name}">购买</s:a>
													<s:a href="ShopPetShow?id=%{pet_Id}&name=%{pet_Name}">详情</s:a>
												</td>
											</tr>
										</table>

									</td>
								</tr>
							</table>
						</s:iterator>
						<s:url id="url_pre" value="ShopPet">
							<s:param name="pageNow" value="pageNow-1"></s:param>
							<s:param name="condition" value="condition"></s:param>
							<s:param name="choose" value="choose"></s:param>
						</s:url>

						<s:url id="url_next" value="ShopPet">
							<s:param name="pageNow" value="pageNow+1"></s:param>
							<s:param name="condition" value="condition"></s:param>
							<s:param name="choose" value="choose"></s:param>
						</s:url>
						<s:iterator value="pets" status="status">
							<s:url id="url" value="ShopPet">
								<s:param name="pageNow" value="pageNow" />
							</s:url>
						</s:iterator>
						<s:if test="pageNow==1">
							<s:a href="%{url_pre}" cssStyle="color:#535353">首页</s:a>
						</s:if>
						<s:else>
							<s:a href="%{url_pre}">上一页</s:a>
						</s:else>
						<s:bean name="org.apache.struts2.util.Counter" id="counter">
							<s:param name="first" value="1" />
							<s:param name="last" value="intPageCount" />
							<s:iterator>
								<s:a
									href="ShopPet?pageNow=%{current-1}&condition=%{condition}&choose=%{choose}">
									<font size="2" color="#A994A4"><s:property />页</font>
								</s:a>
							</s:iterator>
						</s:bean>
						<s:if test="pageNow==intPageCount">
							<s:a href="%{url_next}">末页</s:a>
						</s:if>
						<s:else>
							<s:a href="%{url_next}">下一页</s:a>
						</s:else>

						<div align="center"></div>
					</div>
				</div>
				<div style="clear: both"></div>
			</div>
	</body>
</html>
